{#

This file is part of the Sonata package.

(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

#}

{% extends base_template %}






{% block body %}
{% block list_filters %}
<div {{ admin.isChild and 1 == admin.datagrid.filters|length ? 'style="display: none"' : '' }} id="systemUser-information" class="box searchForm toggableForm">

   
    <a class="toggle tiptip" href="#">></a>
</div>
{% endblock %}
<div id="customerList">
    <div id="search-results" class="box noHeader">
        <div class="inner">
            <form id="frmList_ohrmListComponent" name="frmList_ohrmListComponent" action="/index.php/admin/deleteSystemUsers" method="post">
            {% block actions %}
                    <div class="top">
                   {% include 'SifastProjectBundle:Core:create_button.html.twig' %}
                        </div>
            {% endblock %}
                        <div id="tableWrapper">

{% block list_table %}
    {% set batchactions = admin.batchactions %}
    {% if admin.datagrid.results|length > 0 %}
                            <form action="{{ admin.generateUrl('batch', {'filter': admin.filterParameters}) }}" method="POST" >
                                <table class="table hover">
                {% block table_header %}
                                        <thead>
                                            <tr class="sonata-ba-list-field-header">
                            {% for field_description in admin.list.elements %}
                                {% if field_description.getOption('code') == '_batch' and batchactions|length > 0%}
                                                    <th class="checkbox-col">
                                                        <input type="checkbox" id="list_batch_checkbox" />
                                                    </th>
                                {% elseif field_description.name == '_action' and app.request.isXmlHttpRequest %}
                                        {# Action buttons disabled in ajax view! #}
                                {% else %}
                                    {% set sortable = false %}
                                    {% if field_description.options.sortable is defined and field_description.options.sortable%}
                                        {% set sortable             = true %}
                                        {% set current              = admin.datagrid.values._sort_by == field_description %}
                                        {% set sort_parameters      = admin.modelmanager.sortparameters(field_description, admin.datagrid) %}
                                        {% set sort_active_class    = current ? 'sonata-ba-list-field-order-active' : '' %}
                                        {% set sort_by              = current ? admin.datagrid.values._sort_order : field_description.options._sort_order %}
                                    {% endif %}

                                    {% spaceless %}
                                                    <th class="header  {% if sortable %}{% endif %}">
                                            {% if sortable %}<a class="null" href="{{ admin.generateUrl('list', sort_parameters) }}">{% endif %}
                                            {{ admin.trans(field_description.label) }}
                                            {% if sortable %}</a>{% endif %}
                                                            </th>
                                    {% endspaceless %}
                                {% endif %}
                            {% endfor %}
                                                            <th>Action</th>
                                                        </tr>
                                                    </thead>
                {% endblock %}

                {% block table_body %}
                                                    <tbody>
                        {% for object in admin.datagrid.results %}
                                                            <tr>
                                {% for field_description in admin.list.elements %}
                                    {% if field_description.name == '_action' and app.request.isXmlHttpRequest %}
                                        {# Action buttons disabled in ajax view! #}
                                    {% else %}
                                        {{ object|render_list_element(field_description) }}
                                   	{% endif %}
                                {% endfor %}
                                                                    <td style="padding: 0px"><a><img src='/images/Afficher.png'/></a><a><img src='/images/modifier.png'/></a><a><img src='/images/supprimer.png'/></a></td>


                                                                </tr>
                        {% endfor %}
                                                           {% endblock %}

                {% block table_footer %}
                                                                <tr>
                                                                    <th colspan="{{ admin.list.elements|length +1- (app.request.isXmlHttpRequest ? 2 : 0) }}">
                                                            <div class="form-inline">
                                {% if not app.request.isXmlHttpRequest and batchactions|length > 0 %}
                                    {% block batch %}
                                                                    <script type="text/javascript">
                                                                        {% block batch_javascript %}
                                                                        jQuery(document).ready(function ($) {
                                                                            $('#list_batch_checkbox').click(function () {
                                                                                $(this).closest('table').find("td input[type='checkbox']").attr('checked', $(this).is(':checked')).parent().parent().toggleClass('sonata-ba-list-row-selected', $(this).is(':checked'));
                                                                            });
                                                                            $("td.sonata-ba-list-field-batch input[type='checkbox']").change(function () {
                                                                                $(this).parent().parent().toggleClass('sonata-ba-list-row-selected', $(this).is(':checked'));
                                                                            });
                                                                        });
                                                                        {% endblock %}
                                                                        </script>

                                        {% block batch_actions %}
                                                                        <label class="checkbox" for="{{ admin.uniqid }}_all_elements">
                                                                            <input type="checkbox" name="all_elements" id="{{ admin.uniqid }}_all_elements"/>
                                                {{ 'all_elements'|trans({}, 'SonataAdminBundle') }}
                                                                        </label>

                                                                        <select name="action" style="width: auto; height: auto">
                                                {% for action, options in batchactions %}
                                                                                <option value="{{ action }}">{{ options.label }}</option>
                                                {% endfor %}
                                                                            </select>

                                                                            <input type="submit" class="btn btn-small btn-primary" value="{{ 'btn_batch'|trans({}, 'SonataAdminBundle') }}"/>
                                                                            <div class="pull-right">
                                                {% if admin.hasRoute('export') and admin.isGranted("EXPORT") and admin.getExportFormats()|length %}
                                                    {{ "label_export_download"|trans({}, "SonataAdminBundle") }}
                                                    {% for format in admin.getExportFormats() %}
                                                                                    <a href="{{ admin.generateUrl('export', admin.modelmanager.paginationparameters(admin.datagrid, 0) + {'format' : format}) }}">{{ format }}</a>{% if not loop.last %},{% endif %}
                                                    {% endfor %}

                                                                                    &nbsp;-&nbsp;
                                                {% endif %}

                                                {{ admin.datagrid.pager.page }} / {{ admin.datagrid.pager.lastpage }}

                                                                                    &nbsp;-&nbsp;

                                                {% transchoice admin.datagrid.pager.nbresults with {'%count%': admin.datagrid.pager.nbresults} from 'SonataAdminBundle' %}list_results_count{% endtranschoice %}

                                                {% if not app.request.isXmlHttpRequest %}
                                                                                    &nbsp;-&nbsp;
                                                                                    <label class="control-label" for="{{ admin.uniqid }}_per_page">{% trans from 'SonataAdminBundle' %}label_per_page{% endtrans %}</label>
                                                                                    <select class="per-page small" id="{{ admin.uniqid }}_per_page" style="width: auto; height: auto">
                                                        {% for per_page in admin.getperpageoptions %}
                                                                                            <option {% if per_page == admin.datagrid.pager.maxperpage %}selected="selected"{% endif %} value="{{ admin.generateUrl('list', {'filter': admin.datagrid.values | merge({'_per_page': per_page})}) }}">
                                                                {{ per_page }}
                                                                                                </option>
                                                        {% endfor %}
                                                                                            </select>
                                                {% endif %}
                                                                                        </div>
                                        {% endblock %}
                                    {% endblock %}
                                {% endif %}
                                                                                    </div>
                                                                                    </th>
                                                                                    </tr>
                    {% if admin.datagrid.pager.haveToPaginate() %}
                                                                                    <tr>
                                                                                        <td colspan="{{ admin.list.elements|length }}">
                                                                                            <div class="pagination pagination-centered">
                                                                                                <ul>
                                        {% if admin.datagrid.pager.page != 1  %}
                                                                                                        <li><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, 1)) }}" title="{{ 'link_first_pager'|trans({}, 'SonataAdminBundle') }}">&laquo;</a></li>
                                        {% endif %}

                                        {% if admin.datagrid.pager.page != admin.datagrid.pager.previouspage %}
                                                                                                        <li><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, admin.datagrid.pager.previouspage)) }}" title="{{ 'link_previous_pager'|trans({}, 'SonataAdminBundle') }}">&lsaquo;</a></li>
                                        {% endif %}

                                        {# Set the number of pages to display in the pager #}
                                        {% for page in admin.datagrid.pager.getLinks() %}
                                            {% if page == admin.datagrid.pager.page %}
                                                                                                        <li class="active"><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, page)) }}">{{ page }}</a></li>
                                            {% else %}
                                                                                                        <li><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, page)) }}">{{ page }}</a></li>
                                            {% endif %}
                                        {% endfor %}

                                        {% if admin.datagrid.pager.page != admin.datagrid.pager.nextpage %}
                                                                                                        <li><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, admin.datagrid.pager.nextpage)) }}" title="{{ 'link_next_pager'|trans({}, 'SonataAdminBundle') }}">&rsaquo;</a></li>
                                        {% endif %}

                                        {% if admin.datagrid.pager.page != admin.datagrid.pager.lastpage  %}
                                                                                                        <li><a href="{{ admin.generateUrl('list', admin.modelmanager.paginationparameters(admin.datagrid, admin.datagrid.pager.lastpage)) }}" title="{{ 'link_last_pager'|trans({}, 'SonataAdminBundle') }}">&raquo;</a></li>
                                        {% endif %}
                                                                                                    </ul>
                                                                                                </div>
                                                                                            </td>
                                                                                        </tr>
                    {% endif %}
                {% endblock %}
                                                                                    </table>
                                                                                </form>
    {% else %}
                                                                                <p class="notice">
            {{ 'no_result'|trans({}, 'SonataAdminBundle') }}
                                                                                    </p>
    {% endif %}
{% endblock %}

                                                                                </div>


                                                                            </form>
                                                                        </div>
                                                                    </div></div>


{% block side_menu %}{{ knp_menu_render(admin.sidemenu(action), {'currentClass' : 'active'}, 'list') }}{% endblock %}

                                                            {% endblock %}
